#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <Dynamics/force_module.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;

template<typename T>
static void declareForceModule(py::module &mod, const std::string &typestr)
{
    using class_type = ForceModule<T>;
    auto pyclass_name = std::string("ForceModule") + typestr;
    py::class_<class_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    //you can't define the construction function for abstract class.
    cls.def("allocateResource", &class_type::allocateResource);
    cls.def("deformEnergy", &class_type::deformEnergy);

    /**
     * can't expose the stiffnessMatrix function because pybind11 has problem to bind eigen datastructure now. 
     */
    //cls.def("stiffnessMatrix", &class_type::stiffnessMatrix);
}

void initForceModule(py::module &m)
{
    declareForceModule<float>(m, std::string("F"));
    declareForceModule<double>(m, std::string("D"));
}
